<include file="Common:layout" />
<body style="background-color: rgb(255, 255, 255); overflow: auto; cursor: default; -moz-user-select: inherit;">
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page">
    <div class="fixed-bar">
        <div class="item-title">
            <div class="subject">
                <h3>退货申请</h3>
                <h5>退货订单列表</h5>
            </div>
        </div>
    </div>

    <div id="explanation" class="explanation" style="color: rgb(44, 188, 163); background-color: rgb(237, 251, 248); width: 99%; height: 100%;">
        <div id="checkZoom" class="title"><i class="fa fa-lightbulb-o"></i>
            <h4 title="提示相关设置操作时应注意的要点">操作提示</h4>
            <span title="收起提示" id="explanationZoom" style="display: block;"></span>
        </div>
        <ul>
            <li>已付款，在待发货中或者在待收货中取消的订单则为退款单</li>
            <li>退款单列表</li>
        </ul>
    </div>
    <div class="flexigrid">
        <div class="mDiv" style="height: 44px">
            <div class="ftitle">
                <h3>退货单列表</h3>
                <h5>(共{$count}条记录)</h5>
            </div>

            <form action="{:U('Order/return_list')}" id="form_data" class="navbar-form form-inline" method="post" onSubmit="return check_form();">
                <div class="sDiv" style="margin-right:50px">
                    <div class="sDiv2">
                        <!--排序规则-->
                        <!--<input type="text" name="consignee"  placeholder="处理状态" value="">-->
                        <input type="text" size="14" id="shop_name" name="shop_name" placeholder="填写店铺名" value="{$shop_name}">
                        <select  class="select" name="shop_id" id="shop_id">
                            <option value="">请选择店铺名</option>
                        </select>
                        <select class="select" name="order_status" size="1">
                            <option value="0">请选择状态</option>
                            <option value="3">未通过</option>
                            <option value="2">通过</option>
                            <option value="1">待审核</option>
                        </select>
                        <input type="text" name="order_num"  placeholder="订单编号" value="{$data['order_num']}">
                        <input type="text" name="start_time" id="start_time" placeholder="开始时间" value="{$data['start_time']}">
                        <input type="text" name="end_time" id="end_time" placeholder="结束时间" value="{$data['end_time']}">
                        <input type="button" class="btn" value="搜索" />
                    </div>
                </div>
            </form>
        </div>

        <div class="hDiv">
            <div class="hDivBox">
                <table cellspacing="0" cellpadding="0">
                    <thead>
                    <tr>
                        <th align="center" abbr="article_title" axis="col6" class="mhover">
                            <div style="text-align: center; width:140px;" class="">订单编号</div>
                        </th>
                        <th align="center" abbr="article_title" axis="col6" class="mhover">
                            <div style="text-align: center; width:100px;" class="">商品id</div>
                        </th>
                        <th align="center" abbr="article_title" axis="col6" class="mhover">
                            <div style="text-align: center; width:100px;" class="">店铺名字</div>
                        </th>
                        <th align="center" abbr="ac_id" axis="col4">
                            <div style="text-align: center; width: 80px;" class="">下单人</div>
                        </th>
                        <th align="center" abbr="ac_id" axis="col4">
                            <div style="text-align: center; width: 100px;" >联系电话</div>
                        </th>
                        <th align="center" abbr="article_time" axis="col6">
                            <div style="text-align: center; width: 60px;">物流费用</div>
                        </th>
                        <th align="center" abbr="article_show" axis="col6">
                            <div style="text-align: center; width: 120px;" >申请退款时间</div>
                        </th>
                        <th align="center" abbr="article_show" axis="col6">
                            <div style="text-align: center; width: 60px;" >退款小计</div>
                        </th>
                        <th align="center" abbr="article_show" axis="col6">
                            <div style="text-align: center; width: 60px;" >处理状态</div>
                        </th>
                        <th align="center" abbr="article_show" axis="col6">
                            <div style="text-align: center; width: 150px;" >操作</div>
                        </th>
                        <th style="width:100%" axis="col7">
                            <div></div>
                        </th>
                    </tr>
                    </thead>
                </table>
            </div>
        </div>
        <div class="bDiv" style="height: auto;">
            <div id="flexigrid" cellpadding="0" cellspacing="0" border="0">
                <table>
                    <tbody>
                    <volist name="order_info" id="vo">
                        <tr>
                            <td align="center" axis="col0">
                                <div style="width: 140px;text-align: center;">{$vo.t_order_id}</div>
                            </td>
                            <td align="center" axis="col0">
                                <div style="width: 100px;text-align: center;">{$vo.good_id}</div>
                            </td>
                            <td align="center" axis="col0">
                                <div style="width: 100px;text-align: center;">{$vo.shop_name}</div>
                            </td>
                            <td align="center" axis="co10">
                                <div style="width: 80px;text-align: center;">{$vo.name}</div>
                            </td>
                            <td align="center" axis="col0">
                                <div style="text-align: center; width: 100px;">{$vo.user_phone}</div>
                            </td>
                            <td align="center" axis="col0">
                                <div style="text-align: center; width: 60px;">{$vo.send_type}</div>
                            </td>
                            <td align="center" axis="col0">
                                <div style="text-align: center; width: 120px;">{$vo.back_time}</div>
                            </td>
                            <td align="center" axis="col0">
                                <div style="text-align: center; width: 60px;">{$vo.back_sum}</div>
                            </td>
                            <td align="center" axis="col0">
                                <div style="text-align: center; width: 60px;">
                                    <if condition="$vo.back_status eq 1">待审核</if>
                                    <if condition="$vo.back_status eq 2"><label style="color:green;">通过</label></if>
                                    <if condition="$vo.back_status eq 3"><label style="color:red;">未通过</label></if>
                                </div>
                            </td>
                            <td align="center" axis="col0">
                                <div style="text-align: center; width: 150px;">
                                    <a class="btn blue" href="{:U('Order/return_good_info',array('order_id'=>$vo['order_id'],'good_id'=>$vo['good_id']))}" >
                                        <i class="fa fa-search"></i>查看
                                    </a>
                                </div>
                            </td>
                            <td axis="col7" style="width: 100%;">
                                <div>&nbsp;</div>
                            </td>
                        </tr>
                    </volist>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
    {$page}
</div>
<script type="text/javascript" src="__PUBLIC__/usr/js/layer/laydate/laydate.js"></script>
<script type="text/javascript">
    $(function() {
        //日历插件
        $('#start_time').layDate();
        $('#end_time').layDate();
        $(".btn").click(function () {
            $("#form_data").submit();
        })


    $("#shop_name").keyup(function(){
        $aName = $(this).val();
        if($aName != ''){
            getAgentName();
        }else{
            return false;
        }
    });

        $("#shop_name").change(function () {
            $aName = $(this).val();
            if ($aName != '') {
                getAgentName();
            } else {
                return false;
            }
        });
    });
    function getAgentName()
    {
        $.ajax({
            url: "{:U('Order/searchShopName')}",
            type: "post",
            data: {aName : $aName},
            success: function (data)
            {
                var options = '<option value="">请选择店铺名</option>';
                if (data) {
                    $.each(data, function(k, v){
                        options += '<option value="'+ v.id +'">'+ v.shop_name +'  '+v.company+'</option>';
                    });
                }
                $("#shop_id").html(options);
            }
        });
    }

    function check_form(){
        var start_time = $.trim($('#start_time').val());
        var end_time =  $.trim($('#end_time').val());

        var start_timestamp = Date.parse(new Date(start_time));
        start_timestamp = start_timestamp / 1000;

        var end_timestamp = Date.parse(new Date(end_time));
        end_timestamp = end_timestamp/1000;

        if(start_timestamp > end_timestamp){
            layer.msg("开始时间必须大于结束时间");return false;
        }
        if(start_time == '' ^ end_time == ''){
            layer.alert('请选择完整的时间间隔');
            return false;
        }
        return true;
    }
</script>
</body>
</html>

